origWndProc As Long ' Parent form's original WndProc address
lParenthWnd As Long ' Parent form's hWnd
lTophWnd As Long ' MDIForm parent form hWnd
lTrayhWnd As Long ' System tray hWnd
lseHwnd As Long ' MHDock control hWnd
lxDock As Long ' xDock property
lyDock As Long ' yDock property
bDockEnabled As Long
End Type
Public Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Public Type POINTAPI
X As Long
Y As Long
End Type
Public Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal hwnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Public Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (hpvDest As Any, hpvSource As Any, ByVal cbCopy As Long)
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Public Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Public Declare Function GetDesktopWindow Lib "user32" () As Long
Public Declare Function GetParent Lib "user32" (ByVal hwnd As Long) As Long
Public Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Public Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
Public Declare Function GlobalAlloc Lib "kernel32" (ByVal wFlags As Long, ByVal dwBytes As Long) As Long
Public Declare Function GlobalFree Lib "kernel32" (ByVal hMem As Long) As Long
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Public Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, lpvParam As Any, ByVal fuWinIni As Long) As Long
Public Const GWL_WNDPROC = (-4)
Public Const WM_DESTROY = &H2
Public Const WM_MOVE = &H3
Public Const WM_MOVING = &H216
Public Const WM_MOUSEMOVE = &H200
Public Const WM_ENTERSIZEMOVE = &H231
Public Const WM_EXITSIZEMOVE = &H232
Public Const SPI_GETBORDER = 5
Public Const GMEM_FIXED = &H0
Public Const GMEM_ZEROINIT = &H40
Public Const GPTR = (GMEM_FIXED Or GMEM_ZEROINIT)
Dim seVars As seVarsType, hMem As Long, lLasthWnd As Long
Public Function AppWndProc(ByVal hwnd As Long, ByVal Msg As Long, _
ByVal wParam As Long, ByVal lParam As Long) As Long
Static pSave As POINTAPI, bSnappedX As Boolean, _
bSnappedY As Boolean
Static bLeft As Boolean, bTop As Boolean, bRight As Boolean, _
bBottom As Boolean
Static rOrig As RECT, bOrig As Boolean, rParent As RECT, _
rLatest As RECT
Static lMinX As Long, lMaxX As Long, lMinY As Long, _
lMaxY As Long
Static lxDock As Long, lyDock As Long
If hwnd <> lLasthWnd Then
' Get the seVars structure copy from the locked memory